1. Field of the Invention
The present invention relates to an image processing method and image processing apparatus. Particularly, the present invention relates to an image processing method and image processing apparatus which allow a user to interactively cut out an image displayed on a screen.
2. Description of the Related Art
Image cutout processing is generally used in various stages of interactive image processing. To produce a printed product by laying out images, it is necessary to delete an undesirable background of each image to be laid out.
Various image cutout techniques have been proposed. For example, Japanese Patent Publication Laid-Open No. 7-334675 proposes a technique of scanning the periphery of a read and displayed image to determine background pixels and setting an area other than the background pixels as a cutout area.
FIG. 9 is a view showing processing for cutting out a heart-shaped pattern from the background.
As shown in FIG. 9, in this cutout processing, an original image 800 is scanned from its four sides in directions indicated by arrows. A change in value from pixel to pixel is compared with a predetermined threshold value to check whether the pixel belongs to the background or the cutout target.
In image cutout processing, normally, if the original image 800 completely contains a cutout target 801, as shown in a of FIG. 9, it is possible to cut out the target area and delete a background part 803 without any problem so that an image 802 is obtained by cutout, as shown in b of FIG. 9.
However, the following problem arises in the prior art.
FIG. 10 is a view showing processing for cutting out a portrait as an object from the background.
Even when a portrait 901 with an upper body part from the chest up should be cut out from an original image 900 as shown in a of FIG. 10, scan is executed in the directions indicated by arrows to check a change in value from pixel to pixel from the four sides of the original image 900. In this case, a part 903 of the cutout target contacts with a window edge (lower side). This part is also contained in the scan target. In the prior art, the window edge is recognized as the background. For this reason, the part (the person's chest in this example) in contact with the window edge is recognized as the background color. Consequently, an image 902 obtained by cutout processing cannot accurately contain a chest part 904 of the object person, as shown in b of FIG. 10.